<?php
/**
 * author:式神(289650682@qq.com)
 * time:2017-03-08
 */

//后台登陆相关
Route::group(['namespace'=>"Admin",'prefix' => 'admin'],function($router){
    $router->get('login', 'LoginController@showLogin')->name('admin.login');
    $router->post('login', 'LoginController@login');
    $router->get('logout', 'LoginController@logout')->name('admin.logout');

    Route::get('iconfont', 'CommonController@iconfont')->name('admin.iconfont');
    Route::post('upload', 'CommonController@upload')->name('admin.upload');
});

//后台主页
Route::get('admin', 'Admin\IndexController@index')->name('admin');
Route::group(['namespace'=>"Admin",'prefix' => 'admin'],function(){
	Route::get('index','IndexController@index')->name('admin.index');
	Route::get('welcome','IndexController@welcome')->name('admin.welcome');
    Route::get('menu', 'MenuController@menu')->name('admin.menu');
});


//用户及权限路由
Route::group(['namespace'=>"Admin",'prefix' => 'admin','middleware'=>['route.auth:admin']],function(){

    //用户
    Route::match(['get','post'],'userlist','UserController@userList')->name('admin.user.list');
    Route::post('useradd','UserController@userAdd')->name('admin.user.add');
    Route::match(['get','post'],'usereditrole','UserController@userEditRole')->name('admin.user.edit.role');
    Route::match(['get','post'],'useredit','UserController@userEdit')->name('admin.user.edit');
    Route::post('userdel','UserController@userDel')->name('admin.user.del');

    //角色路由
    Route::match(['get','post'],'rolelist','UserController@roleList')->name('admin.role.list');
    Route::post('roleadd','UserController@roleAdd')->name('admin.role.add');
    Route::match(['get','post'],'roleedit','UserController@roleEdit')->name('admin.role.edit');
    Route::post('roledel','UserController@roleDel')->name('admin.role.del');
    Route::match(['get','post'],'roleset','UserController@roleSet')->name('admin.role.set');

    //权限
    Route::match(['get','post'],'permissionlist','UserController@permissionList')->name('admin.permission.list');
    Route::post('permissionadd','UserController@permissionAdd')->name('admin.permission.add');
    Route::match(['get','post'],'permissionedit','UserController@permissionEdit')->name('admin.permission.edit');
    Route::post('permissiondel','UserController@permissionDel')->name('admin.permission.del');

    //网站配置
    Route::match(['get','post'],'configlist','ConfigController@configList')->name('admin.config.list');
    Route::match(['get','post'],'configadd','ConfigController@configAdd')->name('admin.config.add');
    Route::match(['get','post'],'configedit','ConfigController@configEdit')->name('admin.config.edit');
    Route::post('configdel','ConfigController@configDel')->name('admin.config.del');

    Route::match(['get','post'],'welcome','ConfigController@welcome')->name('admin.config.welcome');
    Route::get('config/putfile', 'ConfigController@putFile')->name('admin.config.putfile');
});